<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2025/3/24
  Time: 11:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OA办公系统</title>
    <link href="css/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body class="bg-gray-100 h-screen flex flex-col">
<!-- 顶部导航栏 -->
<header class="bg-blue-600 text-white shadow-md">
    <div class="container mx-auto px-4 py-3 flex justify-between items-center">
        <div class="flex items-center space-x-2">
            <i class="fas fa-building text-2xl"></i>
            <h1 class="text-xl font-bold">企业OA办公系统</h1>
        </div>
        <div class="flex items-center space-x-4">
            <div class="relative">
                <i class="fas fa-bell text-lg cursor-pointer hover:text-blue-200"></i>
                <span class="absolute -top-1 -right-1 bg-red-500 text-xs rounded-full h-4 w-4 flex items-center justify-center">3</span>
            </div>
            <div class="flex items-center space-x-2 cursor-pointer hover:text-blue-200">
                <img src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="用户头像" class="h-8 w-8 rounded-full">
                <span>张经理</span>
                <i class="fas fa-chevron-down text-xs"></i>
            </div>
        </div>
    </div>
</header>

<!-- 主体内容 -->
<div class="flex flex-1 overflow-hidden">
    <!-- 侧边栏导航 -->
    <nav class="bg-white w-64 shadow-lg flex-shrink-0 h-full">
        <div class="p-4">
            <div class="flex items-center justify-center p-2 mb-4">
                <div class="text-center">
                    <img src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="用户头像" class="h-16 w-16 rounded-full mx-auto mb-2">
                    <h3 class="font-medium text-gray-800">张经理</h3>
                    <p class="text-sm text-gray-500">市场部 - 部门经理</p>
                </div>
            </div>
            <ul class="space-y-1">
                <li>
                    <a href="#" onclick="loadPage('pages/dashboard.jsp')" class="flex items-center p-3 text-gray-700 bg-blue-50 rounded-lg hover:bg-blue-100">
                        <i class="fas fa-tachometer-alt w-5 text-blue-500"></i>
                        <span class="ml-3">工作台</span>
                    </a>
                </li>

                <li>
                    <a href="#" onclick="loadPage('pages/employee.jsp')" class="flex items-center p-3 text-gray-700 rounded-lg hover:bg-blue-100">
                        <i class="fas fa-address-book w-5 text-blue-500"></i>
                        <span class="ml-3">员工管理</span>
                    </a>
                </li>
                <li>
                    <a href="#" onclick="loadPage('pages/contacts.html')" class="flex items-center p-3 text-gray-700 rounded-lg hover:bg-blue-100">
                        <i class="fas fa-address-book w-5 text-blue-500"></i>
                        <span class="ml-3">通讯录</span>
                    </a>
                </li>
                <li>
                    <a href="#" onclick="loadPage('pages/attendance.jsp')" class="flex items-center p-3 text-gray-700 rounded-lg hover:bg-blue-100">
                        <i class="fas fa-user-clock w-5 text-blue-500"></i>
                        <span class="ml-3">考勤管理</span>
                    </a>
                </li>
                <li>
                    <a href="#" onclick="loadPage('pages/attendance.html')" class="flex items-center p-3 text-gray-700 rounded-lg hover:bg-blue-100">
                        <i class="fas fa-user-clock w-5 text-blue-500"></i>
                        <span class="ml-3">部门管理</span>
                    </a>
                </li>
                <li>
                    <a href="#" onclick="loadPage('pages/attendance.html')" class="flex items-center p-3 text-gray-700 rounded-lg hover:bg-blue-100">
                        <i class="fas fa-user-clock w-5 text-blue-500"></i>
                        <span class="ml-3">个人中心</span>
                    </a>
                </li>
            </ul>
        </div>
    </nav>

    <!-- 内容区域 -->
    <main class="flex-1 overflow-hidden">
        <iframe id="contentFrame" src="pages/dashboard.jsp" class="w-full h-full border-none"></iframe>
    </main>
</div>

<script>
    function loadPage(url) {
        console.log(url);
        document.getElementById('contentFrame').src = url;

        // 更新导航菜单的活动状态
        const menuItems = document.querySelectorAll('nav ul li a');
        menuItems.forEach(item => {
            if (item.getAttribute('onclick').includes(url)) {
                item.classList.add('bg-blue-50');
            } else {
                item.classList.remove('bg-blue-50');
            }
        });
    }

    // 默认加载工作台页面
    document.addEventListener('DOMContentLoaded', function() {
        loadPage('pages/dashboard.jsp');
    });
</script>
</body>
</html>
